package com.gobrs.async.core.config;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class ConfigFactory {

    /**
     * 任务流程规则配置
     */
    private Map<String, RuleConfig> processRules = new ConcurrentHashMap();

    /**
     * 全局配置
     */
    private GobrsAsyncProperties gobrsAsyncProperties;

    public ConfigFactory(GobrsAsyncProperties gobrsAsyncProperties) {
        this.gobrsAsyncProperties = gobrsAsyncProperties;
    }

    public Map<String, RuleConfig> getProcessRules() {
        return processRules;
    }

    public void setProcessRules(Map<String, RuleConfig> processRules) {
        this.processRules = processRules;
    }

    public GobrsAsyncProperties getGobrsAsyncProperties() {
        return gobrsAsyncProperties;
    }

    public void setGobrsAsyncProperties(GobrsAsyncProperties gobrsAsyncProperties) {
        this.gobrsAsyncProperties = gobrsAsyncProperties;
    }

    public RuleConfig addRule(String ruleName, RuleConfig rule) {
        return this.processRules.put(ruleName, rule);
    }

}
